home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / scope / 001-025 / scopedisk17 / dmcspec1.0 / dmcspect.c < prev    next >
C/C++ Source or Header  |  1995-03-18  |  2KB  |  75 lines

  1. /*********************************************************/
  2. /*                                                       */
  3. /*  DMCSpect V1.0 -- Inom Software (c) 1988              */
  4. /*                                                       */
  5. /*  Author        : Erick Scott Dyke                     */
  6. /*  Computer      : Commodore Amiga 1000                 */
  7. /*  Processor     : Motorola 68000                       */
  8. /*  Language      : Lattice AmigaDos C Compiler V4.00    */
  9. /*                                                       */
  10. /*  Purpose       : This program, based on the idea and  */
  11. /*                  Amiga Basic code of Doug Pelletier,  */
  12. /*                  finds all the instruments needed by  */
  13. /*                  DMCS to play the song properly.      */
  14. /*                                                       */
  15. /*  This program is public domain, and I hope that any   */
  16. /*  copies of the source code you distribute still have  */
  17. /*  this program header. -- Enjoy!                       */
  18. /*                                                       */
  19. /*********************************************************/
  20.  
  21. #include "stdio.h"
  22. #include "string.h"
  23.  
  24. void main (argc, argv)
  25.  
  26. int      argc;
  27. char    *argv[];
  28.  
  29. {
  30. FILE    *File_Pointer;
  31.  
  32. char     Input_Character;
  33. char     Command [4];
  34. char     Dummy [4];
  35.  
  36. Command [3] = '\0';
  37.  
  38.    printf ("\nInom Software's Deluxe Music Instrument Identifier.\n");
  39.  
  40.    if (argc < 2) 
  41.       {
  42.       printf ("Usage: DMCSpect <file name>\n");
  43.       exit (0);
  44.       }
  45.  
  46.    if ((File_Pointer = fopen (argv [1], "rb")) == NULL)
  47.       { 
  48.       printf ("\nSorry, invalid file name.\n");
  49.       exit (0);
  50.       }
  51.  
  52.    printf ("\nInstruments needed for the song %s:\n\n", argv [1]);
  53.  
  54.    fseek (File_Pointer, -1000L, 2);
  55.  
  56.    Input_Character = getc (File_Pointer);
  57.    while (!feof (File_Pointer)) 
  58.       {
  59.       if (Input_Character == 'U')
  60.          {
  61.          fread (Command, 1, 3, File_Pointer);
  62.          if (!strcmp (Command, "IID"))
  63.             {
  64.             fread (Dummy, 1, 4, File_Pointer);
  65.             while (((Input_Character = getc (File_Pointer)) != 'U') && (!feof (File_Pointer)))
  66.                printf ("%c", Input_Character);
  67.             printf ("\n");
  68.             ungetc (Input_Character, File_Pointer); 
  69.             }
  70.          }
  71.       Input_Character = getc(File_Pointer);
  72.       }
  73.    fclose (File_Pointer); 
  74. }
  75.